package com.laker.autotest.api.core.auth;

import java.util.Base64;

/**
 * Basic Auth Token Provider
 */
public class BasicAuthTokenProvider implements AuthTokenProvider {
    private final String username;
    private final String password;

    public BasicAuthTokenProvider(String username, String password) {
        this.username = username;
        this.password = password;
    }

    private String getToken() {
        String auth = username + ":" + password;
        return Base64.getEncoder().encodeToString(auth.getBytes());
    }

    @Override
    public String getAuthHeader() {
        return "Basic " + getToken();
    }
}